import request from "@/utils/request";

// 查询废料结算列表
export function listWastesettle(query) {
  return request({
    url: "/mes/wastesettle/list",
    method: "get",
    params: query,
  });
}

// 查询废料结算详细
export function getWastesettle(id) {
  return request({
    url: "/mes/wastesettle/" + id,
    method: "get",
  });
}

// 新增废料结算
export function addWastesettle(data) {
  return request({
    url: "/mes/wastesettle",
    method: "post",
    data: data,
  });
}

// 修改废料结算
export function updateWastesettle(data) {
  return request({
    url: "/mes/wastesettle",
    method: "put",
    data: data,
  });
}
// 导出
export function wasteExport(data) {
  return request({
    url: "/mes/wastesettle/export",
    method: "post",
    data: data,
    responseType: "blob",
  });
}

// 删除废料结算
export function delWastesettle(id) {
  return request({
    url: "/mes/wastesettle/" + id,
    method: "delete",
  });
}
// 发票上传
export const addOrEditMesFile = (data) => {
  return request({
    url: "/mes/file/addOrEditMesFile",
    method: "post",
    data,
  });
};
// 发票查询
export const getOrEditMesFile = (query) => {
  return request({
    url: "/mes/file/getMesFile",
    method: "get",
    params: query,
  });
};
// 发票删除
export const delOrEditMesFile = (id, foreignKey) => {
  return request({
    url: `/mes/file/delMesFile?id=${id}&foreignKey=${foreignKey}`,
    method: "post",
  });
};
